package com.eclipse.training.extensions.ui;

import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.viewers.IColorDecorator;
import org.eclipse.jface.viewers.ILabelDecorator;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Display;

import com.eclipse.training.extensions.Activator;
import com.eclipse.training.extensions.preferences.IPreferenceConstants;

public class ModelDecoratorLabelProvider implements IColorDecorator,
		ILabelDecorator {

	@Override
	public Color decorateForeground(Object element) {

		IPreferenceStore store = Activator.getDefault().getPreferenceStore();						
		RGB rgb = PreferenceConverter.getColor(store,
				IPreferenceConstants.P_COLOR);
		return new Color(Display.getDefault(), rgb);
	}

	@Override
	public Color decorateBackground(Object element) {
		return null;
	}

	@Override
	public void addListener(ILabelProviderListener listener) {
	}

	@Override
	public void dispose() {

	}

	@Override
	public boolean isLabelProperty(Object element, String property) {
		return false;
	}

	@Override
	public void removeListener(ILabelProviderListener listener) {
	}

	@Override
	public Image decorateImage(Image image, Object element) {
		return null;
	}

	@Override
	public String decorateText(String text, Object element) {
		return null;
	}

}
